import 'package:freezed_annotation/freezed_annotation.dart';

part 'home_model.freezed.dart';
part 'home_model.g.dart';

@freezed
class HomeModel with _$HomeModel {
  factory HomeModel({
    @Default([]) List<ImageBannersModel> imageBanners,
    @Default([]) List<CategoryGrids> categoryGrids,
    @Default([]) List<HotRecommendsModel> hotRecommends,
    @Default([]) List<FreshGoodsModel> freshGoods,
    @Default([]) List<HotBrandsModel> hotBrands,
    @Default([]) List<TopicsModel> projects,
    @Default([]) List<CategoryBannersModel> categoryBanners,
  }) = _HomeModel;
  
  factory HomeModel.fromJson(Map<String, dynamic> json) => _$HomeModelFromJson(json);
}

@freezed
class ImageBannersModel with _$ImageBannersModel {
  factory ImageBannersModel({
    required String? id,
    required String? imgUrl,
  }) = _ImageBannersModel;
  
  factory ImageBannersModel.fromJson(Map<String, dynamic> json) => _$ImageBannersModelFromJson(json);
}


@freezed
class CategoryGrids with _$CategoryGrids {
  factory CategoryGrids({
    required String? id,
    required String? picture,
    required String? name,
  }) = _CategoryGrids;
  
  factory CategoryGrids.fromJson(Map<String, dynamic> json) => _$CategoryGridsFromJson(json);
}


@freezed
class HotRecommendsModel with _$HotRecommendsModel {
  const factory HotRecommendsModel({
    required String? caption,
    required String? leftIcon,
    required String? rightIcon,
    required String? title,
  }) = _HotRecommendsModel;

  factory HotRecommendsModel.fromJson(Map<String, dynamic> json) => _$HotRecommendsModelFromJson(json);
}


@freezed
class FreshGoodsModel with _$FreshGoodsModel {
  const factory FreshGoodsModel({
    required String desc,
    required String id,
    required String name,
    required int orderNum,
    required String picture,
    required String price,
  }) = _FreshGoodsModel;

  factory FreshGoodsModel.fromJson(Map<String, dynamic> json) => _$FreshGoodsModelFromJson(json);
}


@freezed
class HotBrandsModel with _$HotBrandsModel {
  const factory HotBrandsModel({
    required String desc,
    required String id,
    required String logo,
    required String name,
    required String nameEn,
    required String picture,
    required String place,
  }) = _HotBrandsModel;

  factory HotBrandsModel.fromJson(Map<String, dynamic> json) => _$HotBrandsModelFromJson(json);
}


@freezed
class TopicsModel with _$TopicsModel {
  const factory TopicsModel({
    required String classificationId,
    required int collectNum,
    required String cover,
    required String createTime,
    required String creator,
    required String detailsUrl,
    required String id,
    required int isDelete,
    required int lowestPrice,
    required int replyNum,
    required String summary,
    required String title,
    required String updateTime,
    required int viewNum
  }) = _TopicsModel;

  factory TopicsModel.fromJson(Map<String, dynamic> json) => _$TopicsModelFromJson(json);
}


@freezed
class CategoryBannersModel with _$CategoryBannersModel {
  const factory CategoryBannersModel({
    required String id,
    required String name,
    required String picture,
    @Default([]) List<CategoryBannersGoodsModel> goods,
    @Default([]) List<CategoryBannersChildrenModel> children,
  }) = _CategoryBannersModel;

  factory CategoryBannersModel.fromJson(Map<String, dynamic> json) => _$CategoryBannersModelFromJson(json);
}
@freezed
class CategoryBannersGoodsModel with _$CategoryBannersGoodsModel {
  const factory CategoryBannersGoodsModel({
    required String desc,
    required String id,
    required String name,
    required int orderNum,
    required String picture,
    required String price,
  }) = _CategoryBannersGoodsModel;

  factory CategoryBannersGoodsModel.fromJson(Map<String, dynamic> json) => _$CategoryBannersGoodsModelFromJson(json);
}
@freezed
class CategoryBannersChildrenModel with _$CategoryBannersChildrenModel {
  const factory CategoryBannersChildrenModel({
    required String id,
    required String name,
    required String picture,
  }) = _CategoryBannersChildrenModel;

  factory CategoryBannersChildrenModel.fromJson(Map<String, dynamic> json) => _$CategoryBannersChildrenModelFromJson(json);
}


